#ifndef CNC_BASE_SUBJECT_H
#define CNC_BASE_SUBJECT_H

#include "changemgr.h"

namespace cnc {

	namespace base {

		template <class T>
		class Subject
		{
			ChangeManager *changeManager_;
		public:
			Subject() : changeManager_(0)
			{
			}
			void setChangeManager(ChangeManager *changeManager)
			{
				changeManager_ = changeManager;
			}
		protected:
			void notify()
			{
				if (changeManager_ != 0)
					changeManager_->notify(static_cast<T *>(this));
			}
		};

	} // namespace base

} // namespace cnc

#endif

